home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / sgips.idb / usr / bin / photoshop_sgi.z / photoshop_sgi
Encoding:
Text File  |  1997-04-01  |  19.6 KB  |  792 lines

  1. #!/bin/sh
  2. #Tag 0x00010D80
  3.  
  4. #setup
  5. DFCMD="df -k"
  6. DUCMD="du -sk"
  7.  
  8. # make sure we have the path for xconfirm
  9. PATH=$PATH:/usr/bin/X11
  10. xconfirmPath=`which xconfirm`
  11. if [ $? = 0 ] ; then
  12.     hasUI=1
  13. else
  14.     hasUI=0
  15. fi
  16.  
  17. # test which awk program to use
  18. osVer=`uname -r`
  19. case $osVer
  20. in
  21.     5*) AWK="nawk" ;;
  22.     *) AWK="awk" ;;
  23. esac
  24.  
  25. # get cpu board name
  26. # Note:  currently, the accelerated filters are installed only
  27. # if the CPU board is IP32
  28. ip=`uname -m`
  29.  
  30. # setting up the user splashScreenFile preference
  31. splashScreenFile=$HOME/.photoshop_sgi
  32.  
  33. # save current invoking directory
  34. workdir=$PWD
  35.  
  36. # check for Multiple Instances
  37. checkMultipleInstances()
  38. {
  39.  
  40.     lockFile="$pluginFullpath"/.sgips."$USER".lock
  41.  
  42.     if [ -f "$lockFile" ] ; then
  43.         multinst=1
  44.     else
  45.         multinst=0
  46.         touch "$lockFile"
  47.     fi
  48.     
  49.     if [ "$multinst" -eq 1 ] ; then
  50.     if [ "$hasUI" = 1 ] ; then
  51.         result=`/usr/bin/X11/xconfirm -icon error \
  52.         -t "Another instance of photoshop_sgi is already running. " \
  53.         -t "Running multiple instances of photoshop_sgi may hang or produce bad effects." \
  54.         -t "Exit?" -B Quit  ${1+"$@"}`
  55.     else
  56.         echo "Another instance of photoshop_sgi is already running. "
  57.         echo "Running multiple instances of photoshop_sgi may hang or produce bad effects."
  58.     fi
  59.     exit 1
  60.     fi
  61. }
  62.  
  63.  
  64. # function to check user preference to display the splash screen
  65. displaySplashScreen()
  66. {
  67.     #jump out to support time out splash
  68.     return 1
  69.  
  70.     if [ -f $splashScreenFile -a -r $splashScreenFile ] ; then 
  71.     cat $splashScreenFile | grep "no" > /dev/null
  72.     if [ $? = 0 ] ; then
  73.         return 0
  74.     fi
  75.     fi
  76.     return 1
  77. }
  78.  
  79. # function to locate the real Adobe Photoshop name
  80. getAdobePhotoshopName()
  81. {
  82. #   We need to find the absolute path for Adobe Photoshop launch script 
  83. #   in order to determine what version of photoshop install in the system.
  84. #   In case the user happens run this script inside the actual path of
  85. #   the photoshop directory, we temporary goto the /tmp directory
  86.     tmpDir=
  87.     cd /tmp
  88.     retryGetAdobePhotoshopName=0
  89.  
  90. #   in case the user happens to have an photoshop executable there
  91. #   it will mess everything up.
  92.     if [ -f "photoshop" ] ; then
  93.     tmpDir=.photoshop_sgi.$USER
  94.     mkdir $tmpDir  2> /dev/null
  95.     cd $tmpDir  2> /dev/null
  96.     fi
  97.     AdobePhotoshop=`which photoshop`
  98.  
  99.     if [ $? != 0 ] ; then
  100.     if [ $hasUI = 1 ] ; then
  101.         ret=`xconfirm -c \
  102.          -t "" \
  103.          -t "Adobe Photoshop must be installed to run photoshop_sgi." \
  104.          -t "" \
  105.          -b "OK" \
  106.          -icon error \
  107.          -header "Photoshop Performance Pack" ${1+"$@"} `
  108.     else
  109.         echo "Adobe Photoshop must be installed to run photoshop_sgi."
  110.     fi
  111.     exit 1
  112.     fi
  113.  
  114. #   Determine Adobe Photoshop launch script directory and set it to
  115. #   adobeScriptDir
  116.     if [ -l $AdobePhotoshop ] ; then  
  117.     adobeScriptDir=`ls -l $AdobePhotoshop | $AWK '/bin/ { print $11 }'`
  118.     else
  119.     adobeScriptDir="$AdobePhotoshop"
  120.     fi
  121.  
  122. #   Test if the adobeScriptDir contains a legitimate abs path
  123.     index=
  124.     index=`echo "$adobeScriptDir" | awk '/Photoshop_/ { print $0 }'`
  125.     if [ -z "$index" ] ; then
  126.     adobeScriptDir=
  127.     while [ -z "$adobeScriptDir" ] ; do
  128.         echo " "
  129.         echo " "
  130.         echo "Can't determine Adobe Photoshop directory."
  131.         echo "Please enter the absolute path of the Photoshop launch script."
  132.         echo "It should be something like: "
  133.         echo "/usr/adobe/Photoshop_X.X/bin/photoshop"
  134.         echo " "
  135.         read adobeScriptDir
  136.  
  137.         index=
  138.         index=`echo "$adobeScriptDir" | awk '/Photoshop_/ { print $0 }'`
  139.         if [ -z "$index" ] ; then
  140.         adobeScriptDir=
  141.         fi
  142.     done
  143.     fi
  144.  
  145.     adobeScriptDir=`expr $adobeScriptDir : '\(.*\)/'`
  146.  
  147. #   locate the Adobe Photoshop Root Directory and set it to "adobeRoot"
  148.     adobeRoot=`echo $adobeScriptDir | $AWK 'gsub("/bin", "") { print $0 }'`
  149.   
  150.     num=`expr $adobeScriptDir : ".*/bin"`
  151.     if [ "$num" -gt 0 ] ; then
  152.     adobeVer=`expr $adobeScriptDir : '.*/\(.*\)/bin'`
  153.     else
  154.     adobeVer=`expr $adobeScriptDir : '.*/\(.*\)'`
  155.     fi
  156.  
  157.     ver=$adobeVer
  158.     ver=`echo $ver | $AWK ' gsub("Photoshop_", "") { print $0; }'`
  159.     verFullString=$ver
  160.  
  161.     versionMajor=`echo $ver | $AWK ' {i=index($1, "."); if (i > 1) print substr($1, 1, i-1); else print $1} '`
  162.  
  163.     if [ -z "$versionMajor" ] ; then
  164.     echo "Can't determine what version of photoshop you are running"
  165.     echo "Please check your software installation."
  166.     exit 1
  167.     fi
  168.     scriptAdobe=$adobeScriptDir/photoshop_adobe
  169.  
  170. #   set the Adobe Photoshop launch script in the "AdobePhotoshop"
  171.     if [ -f "$scriptAdobe" ] ; then
  172.     AdobePhotoshop="$scriptAdobe"
  173.     else
  174.     AdobePhotoshop="$adobeScriptDir/photoshop"
  175.     fi
  176.  
  177. #   setup all other pshop variables here
  178.     pshopBin="/usr/lib/pshop/bin"
  179.     adobeRealBinary="$adobeRoot/lib/AdobePhotoshop$verFullString"
  180.     subsExec="$pshopBin/subs"
  181. #    sgiBinary="$pshopBin"/AdobePhotoshop"$verFullString"_sgi
  182.     sgiBinary="$pshopBin"/AdobePhotoshop_sgi
  183.     adobeBinary="$adobeRoot"/lib/AdobePhotoshop"$verFullString"
  184.  
  185. #   restore back to original directory
  186.     test -n "$tmpDir"
  187.     if [ $? = 0 ] ; then
  188.     cd /tmp
  189.     rm -r $tmpDir  2> /dev/null
  190.     fi 
  191.     cd $workdir
  192.     return 0
  193. }
  194.  
  195. isRoot()
  196. {
  197.     STDBINDIR="/usr/bin"
  198.     WHOAMI=`$STDBINDIR/id | $STDBINDIR/sed 's/^[^(]*.\([^)]*\).*/\1/'`
  199.  
  200.     # Abort installation if user not superuser
  201.     if [ "$WHOAMI" != root ] ; then
  202.     if [ $hasUI = 1 ] ; then
  203.         ret=`xconfirm -c \
  204.          -t "" \
  205.          -t "You must be logged in as root to run this command" \
  206.          -t 'Type "su root" and enter the password to become root.' \
  207.          -t "" \
  208.          -b "OK" \
  209.          -icon error \
  210.          -header "Photoshop Performance Pack" ${1+"$@"}` 
  211.     else
  212.         echo ""
  213.         echo "You must be logged in as root to run this command"
  214.         echo 'Type "su root" and enter the password to become root.'
  215.     fi
  216.     exit 1
  217.     fi
  218.     return 0
  219. }
  220.  
  221. runExitCommand()
  222. {
  223.     if [ $hasUI = 1 ] ; then
  224.     ret=`xconfirm -c \
  225.          -t "" \
  226.          -t "To view the updated Icon Catalog, please log out and then back in." \
  227.          -t "When you login select Applications from the Find Toolchest menu button." \
  228.          -t "" \
  229.          -icon info \
  230.          -b "OK" \
  231.          -header "Photoshop Performance Pack" ${1+"$@"}`
  232.     else
  233.     echo "New application icons will not appear in your Icon Catalog until you log"
  234.     echo "out and log back in again (choose "Applications" on the Find toolchest.)"
  235.     echo ""
  236.     fi
  237.  
  238.     return 
  239. }
  240.  
  241. # function to check if the system has been updated
  242. checkSystemHasBeenUpdated()
  243. {
  244.     # test if user has done the update or not
  245.     if [ $versionMajor -le 3 ] ; then
  246.     test -f $sgiBinary 
  247.     ret1=$?
  248.     test -s $sgiBinary
  249.     ret2=$?
  250.     if [ $ret1 != 0 -o $ret2 != 0 ] ; then
  251.         if [ $hasUI = 1 ] ; then
  252.         ret=`xconfirm -c \
  253.          -t "" \
  254.          -t "To enable this program, you" \
  255.          -t "must log in as root and" \
  256.          -t 'execute "photoshop_sgi -update"' \
  257.          -t "" \
  258.          -icon error \
  259.          -b "OK" \
  260.          -header "Photoshop Performance Pack" ${1+"$@"}`
  261.         else
  262.         echo "To enable this program, you"
  263.         echo "must log in as root and"
  264.         echo 'execute "photoshop_sgi -update"'
  265.         fi
  266.         exit 2
  267.     fi
  268.     fi
  269. }
  270.  
  271. # function to check for system command
  272. checkSystemCommand()
  273. {
  274.     if [ $# -gt 2 -o $# -eq 0 ] ; then
  275.     return
  276.     fi
  277.  
  278.     if [ $# = 1 ] ; then
  279.     if [ "$1" = "-update" ] ; then
  280.         isRoot
  281.         fixPhotoshop
  282.         exit 0
  283.     elif [ "$1" = "-default" -o "$1" = "-adobe" ] ; then
  284.         checkSystemHasBeenUpdated
  285.         if [ $? = 0 ] ; then
  286.         isRoot
  287.         if [ $? = 0 ] ; then
  288.             if [ "$1" = "-default" ] ; then
  289. #                rename real Adobe photoshop launch script as photoshop_adobe
  290. #                    install photoshop_sgi as photoshop
  291. #                    rm photoshop_sgi from iconcatalog
  292.             if [ ! -f $adobeScriptDir/photoshop_adobe ] ; then
  293.                 mv "$adobeScriptDir/photoshop" "$adobeScriptDir/photoshop_adobe"
  294.                 ln -s "/usr/bin/photoshop_sgi" "$adobeScriptDir/photoshop"
  295.                 /usr/sbin/iconbookedit -remove "Category:File Name:/usr/bin/photoshop_sgi" -syspage Applications
  296.             runExitCommand
  297.             exit 0
  298.             fi
  299.             else
  300. #                remove symbolic link of photoshop_sgi inside Adobe Photoshop directory
  301. #                 restore photoshop_adobe back to photoshop
  302. #                add photoshop_sgi to iconcatalog
  303.             if [ -f $adobeScriptDir/photoshop_adobe ] ; then
  304.                 rm "$adobeScriptDir/photoshop"
  305.                 mv "$adobeScriptDir/photoshop_adobe" "$adobeScriptDir/photoshop"
  306.                 /usr/sbin/iconbookedit -add "Category:File Name:/usr/bin/photoshop_sgi" -syspage Applications
  307.             runExitCommand
  308.             exit 0
  309.             fi
  310.             fi
  311.  
  312.         fi
  313.         exit 0
  314.         fi
  315.     else 
  316. #   not a system command 
  317.         return
  318.         fi
  319.     fi
  320. }
  321.  
  322. getFreeSpace()
  323. {
  324.     freeSpace=`$DFCMD | $AWK '/\/usr\/lib/ { print $5 }'`
  325.     test -z "$freeSpace"
  326.     if [ $? = 1 ] ; then
  327.         PSFileSystem="/usr/lib"
  328.         return 0
  329.     fi
  330.  
  331.     freeSpace=`$DFCMD | $AWK '/\/usr$/  { print $5 }'`
  332.     test -z "$freeSpace"
  333.     if [ $? = 1 ] ; then
  334.         PSFileSystem="/usr"
  335.         return 0
  336.     fi
  337.  
  338.     freeSpace=`$DFCMD | $AWK '/\/$/  { print $5 }'`
  339.     test -z "$freeSpace"
  340.     if [ $? = 1 ] ; then
  341.         PSFileSystem="/"
  342.         return 0
  343.     else
  344.         echo "Can't locate file system for this application."
  345.         PSFileSystem=""
  346.         return 1
  347.     fi
  348. }
  349.  
  350. # function to determine whether system has enough disk space
  351. # to do any update
  352. checkFreeSpace()
  353. {
  354. #   determine required disk space for the update
  355.     if [ -f "$adobeBinary" ] ; then
  356.         needSpace=`$DUCMD "$adobeBinary" | awk '{ print $1 }'`
  357.     else
  358.         echo "Cannot determine the Adobe Photoshop Binary."
  359.         echo "Check your photoshop installation."
  360.         exit 1
  361.     fi
  362.  
  363. #   determine free space on the file system where "sgips" installed.
  364.     getFreeSpace
  365.  
  366.     if [ $? = 0 ] ; then
  367.         if [ $freeSpace -lt $needSpace ] ; then
  368.         if [ $hasUI = 1 ] ; then
  369.         ret=`xconfirm -c \
  370.              -t "" \
  371.              -t "You do not have enough free space ($freeSpace Kb) " \
  372.              -t "on this filesystem \""$PSFileSystem"\" " \
  373.              -t "to do any update." \
  374.              -t "" \
  375.              -b "OK" \
  376.              -icon error \
  377.              -header "Photoshop Performance Pack" ${1+"$@"}` 
  378.         else
  379.         echo ""
  380.         echo "You do not have enough free space ("$needSpace" Kb)" 
  381.         echo "on this filesystem \""$fileSystem"\" "
  382.         echo "to do any update."
  383.         fi
  384.         exit 1
  385.         else
  386.             return 0
  387.     fi
  388.     else
  389.         echo "Cannot determine the file system where"
  390.         echo "Photoshop Performance Package installed."
  391.         echo "Check your installation."
  392.         exit 1
  393.     fi
  394. }
  395.  
  396.  
  397. fixPhotoshop()
  398. {
  399. #   make sure there is not any symbolic link in
  400. #   plug-in directory
  401.     curDir="$PWD"
  402.     cd "/usr/lib/pshop/plug-ins"
  403.     if [ $? = 0 ] ; then
  404.     for i in *
  405.     do
  406.         if [ -l "$i" ] ; then
  407.         rm "$i" 2> /dev/null
  408.         fi
  409.     done
  410.     fi
  411.     cd "$curDir"
  412.  
  413. #   respin binary if necessary
  414.     if [ $versionMajor -le 3 ] ; then
  415.     test -f $sgiBinary 
  416.     ret1=$?
  417.     test -s $sgiBinary
  418.     ret2=$?
  419.     if [ $ret1 != 0 -o $ret2 != 0 ] ; then
  420. #    if [ ! -f "$sgiBinary" ] ; then
  421.         checkFreeSpace
  422.         $subsExec "aio_sgi_init" "Aio_sgi_init" \
  423.         "aio_write" "Aio_write" \
  424.         "aio_read" "Aio_read" \
  425.         "aio_suspend" "Aio_suspend" \
  426.         "aio_hold" "Aio_hold" \
  427.         "aio_init" "Aio_init" \
  428.         "aio_handle_notify" "Aio_handle_notify" \
  429.         "aiofreelink" "Aiofreelink" \
  430.         "aiochkcnt" "Aiochkcnt" \
  431.         "aio_grab_alock" "Aio_grab_alock" \
  432.         "aio_release_alock" "Aio_release_alock" \
  433.         "aio_wait" "Aio_wait" \
  434.         "aio_new" "Aio_new" \
  435.         "aio_get" "Aio_get" \
  436.         "aio_free" "Aio_free" \
  437.         "aio_call_callback" "Aio_call_callback" \
  438.         "aioinfo" "Aioinfo" \
  439.         "aio_reqprio" "Aio_reqprio" \
  440.         "_aqueue" "_Aqueue" < $adobeBinary > $sgiBinary 
  441.         chmod 755 $sgiBinary
  442.     fi
  443.     fi
  444.  
  445.     echo ""
  446.     checkIrix64DesktopInstall
  447.     check6XLaunchScriptToDisableAsyncIO
  448.     check6XScreenCapture
  449.     checkKPT
  450.     fixKPThelp
  451.  
  452.     if [ $correctDesktop = 1 ] ; then
  453.     fixIrix64DesktopInstall    
  454.     fi
  455.  
  456.     if [ $correct6XLaunchScript = 1 ] ; then
  457.     fix6XLaunchScriptToDisableAsyncIO
  458.     fi
  459.  
  460.     if [ $correctScreenCapture = 1 ] ; then
  461.     fix6XScreenCapture
  462.     fi
  463.  
  464.     if [ $correctKPT = 1 ] ; then
  465.     fixKPT
  466.     fi
  467.  
  468.     if [ $correctDesktop = 0 -a \
  469.      $correct6XLaunchScript = 0 -a \
  470.          $correctKPT = 0 -a \
  471.      $correctScreenCapture = 0 ] ; then
  472.      echo "Photoshop contains necessary fixes.  Nothing additional to do."
  473.     fi
  474.  
  475.     echo ""
  476. }
  477.  
  478. checkIrix64DesktopInstall()
  479. {
  480.     irix64="IRIX64"
  481.     osname=`uname -s`
  482.  
  483.     if [ "$osname" = "$irix64" ] ; then
  484.     filetypeDir="/usr/lib/filetype/install"
  485.     if [ -f $filetypeDir/photoshop.ftr -a \
  486.          -f $filetypeDir/iconlib/photoshop.doc.fti -a \
  487.          -f $filetypeDir/iconlib/photoshop.exec.fti ] ; then
  488.         correctDesktop=0
  489.     else
  490.         correctDesktop=1
  491.     fi
  492.     else
  493.     correctDesktop=0
  494.     fi
  495. }
  496.  
  497. checkKPT()
  498. {
  499. #   assume we don't need to do anything with KPT
  500.     correctKPT=0
  501.  
  502.     if [ -d "/usr/lib/kpt" ] ; then
  503.     rm -f "/tmp/photoshop_kpt"
  504.  
  505.     cat $AdobePhotoshop | $AWK ' \
  506.         /echo Launching Adobe Photoshop/ { print $0 >> "/tmp/photoshop_kpt"; \
  507.         print "_RLD_ARGS=-ignore_unresolved"  >> "/tmp/photoshop_kpt"; \
  508.         print "export _RLD_ARGS # KPT workaround" >> "/tmp/photoshop_kpt"; next; }
  509.         /_RLD_ARGS/ { next; }
  510.         { print >> "/tmp/photoshop_kpt" }'
  511.         
  512.     diff $AdobePhotoshop "/tmp/photoshop_kpt" >/dev/null 2>>/dev/null
  513.  
  514.     if [ $? = 0 ] ; then
  515.         correctKPT=0
  516.     else
  517.         correctKPT=1
  518.     fi
  519.     rm -f "/tmp/photoshop_kpt"
  520.     fi
  521. }
  522.  
  523. fixIrix64DesktopInstall()
  524. {
  525.     echo "Updating Desktop icon"
  526.     desktopDir=$adobeRoot/desktop
  527.     deskScript=$desktopDir/deskinstall
  528.     if [ -f $deskScript ] ; then
  529.     mv "$deskScript" "$deskScript".adobe
  530.     cat $deskScript.adobe | $AWK ' \
  531.         /uname -s/ { print $0 >> "/tmp/deskinstall_tmp";  \
  532.         print "case \"$osname\" in" >> "/tmp/deskinstall_tmp"; \
  533.         print "IRIX*) osname=IRIX ;; " >> "/tmp/deskinstall_tmp"; \
  534.         print "esac" >> "/tmp/deskinstall_tmp"; next }
  535.         { print $0 >> "/tmp/deskinstall_tmp" }'
  536.  
  537. #    execute the new deskinstall script
  538.     cp "/tmp/deskinstall_tmp" $deskScript
  539.     rm "/tmp/deskinstall_tmp"
  540.     chmod 755 $deskScript
  541.     $deskScript
  542.     else
  543.     echo "Can't locate AdobePhotoshopRoot/desktop directory"
  544.     echo "Check your Adobe Photoshop Installation"
  545.     fi
  546. }
  547.  
  548. check6XLaunchScriptToDisableAsyncIO()
  549. {
  550. #    IP=`hinv | awk '/IP[0-9][0-9]*/ { print $4 }'`
  551. #    IP=`hinv | sed -n -e '/[    ]IP/p' | sed -e 's/^.*\(IP..\).*/\1/'`
  552. #
  553. #    if [ "$IP" = "IP32" ]; then
  554. #        correct6XLaunchScript=0
  555. #        return
  556. #    fi
  557.  
  558.     correct6XLaunchScript=0
  559.     osver=`uname -r`
  560.     case $osver in
  561.     5.*) return ;;
  562.     esac
  563.  
  564.     rm -f "/tmp/photoshop_tmp"
  565. #   It is at least 6.X version
  566.     cat $AdobePhotoshop | $AWK ' \
  567.     /export PATH/ { print $0 >> "/tmp/photoshop_tmp"; \
  568.     print "PHOTOSHOP_DEBUG_NO_AIO=1   # get around bug in async I/O with new libc" >> "/tmp/photoshop_tmp"; \
  569.     print "export PHOTOSHOP_DEBUG_NO_AIO" >> "/tmp/photoshop_tmp"; next; } 
  570.     /PHOTOSHOP_DEBUG_NO_AIO/ { next; }
  571.     { print >> "/tmp/photoshop_tmp" }'
  572.  
  573.     diff $AdobePhotoshop "/tmp/photoshop_tmp" >/dev/null 2>>/dev/null 
  574.     if [ $? = 0 ] ; then
  575.     correct6XLaunchScript=0
  576.     rm "/tmp/photoshop_tmp"
  577.     else
  578.     correct6XLaunchScript=1
  579.     fi
  580.  
  581. }
  582.  
  583. fix6XLaunchScriptToDisableAsyncIO()
  584. {
  585.     echo "Updating AsyncIO"
  586.     mv $AdobePhotoshop $adobeScriptDir/photoshop.adobe.orig
  587.     chmod 755 "/tmp/photoshop_tmp" 
  588.     cp "/tmp/photoshop_tmp" $AdobePhotoshop
  589.     rm "/tmp/photoshop_tmp"
  590. }
  591.  
  592. check6XScreenCapture()
  593. {
  594.     srcPlugins="/usr/lib/pshop/plug-ins"
  595.     dstPlugins="$adobeRoot/Adobe$adobeVer/Plug-ins/Acquire_Export"
  596.     retScreenCapture1=0
  597.  
  598.     if [ -f $srcPlugins/ScreenCapture ] ; then
  599.     diff $srcPlugins/ScreenCapture $dstPlugins/Screen\ Capture >/dev/null 2>>/dev/null
  600.     retScreenCapture1="$?"
  601.     fi
  602.  
  603.     if [ $retScreenCapture1 = 1 ] ; then
  604.     correctScreenCapture=1
  605.     else
  606.     correctScreenCapture=0
  607.     fi
  608.  
  609. }
  610.  
  611. fixKPT()
  612. {
  613.     echo "Updating KPT filters"
  614.  
  615.     if [ -d "/usr/lib/kpt" ] ; then
  616.     rm -f "/tmp/photoshop_kpt"
  617.  
  618.     cat $AdobePhotoshop | $AWK ' \
  619.         /echo Launching Adobe Photoshop/ { print $0 >> "/tmp/photoshop_kpt"; \
  620.         print "_RLD_ARGS=-ignore_unresolved"  >> "/tmp/photoshop_kpt"; \
  621.         print "export _RLD_ARGS # KPT workaround" >> "/tmp/photoshop_kpt"; next; }
  622.         /_RLD_ARGS/ { next; }
  623.         { print >> "/tmp/photoshop_kpt" }'
  624.         
  625.     diff $AdobePhotoshop "/tmp/photoshop_kpt" >/dev/null 2>>/dev/null
  626.  
  627.     if [ $? = 0 ] ; then
  628.         correctKPT=0
  629.     else
  630.         chmod 755 "/tmp/photoshop_kpt"
  631.         cp "/tmp/photoshop_kpt" $AdobePhotoshop
  632.     fi
  633.     rm -f "/tmp/photoshop_kpt"
  634.     fi
  635. }
  636.  
  637. fixKPThelp()
  638. {
  639.     KptHelp="/usr/share/Insight/library/SGI_bookshelves/ISV_Help/books/KPT/styles"
  640. #   save current directory
  641.     dir="$PWD"
  642.     if [ -d "$KptHelp" ] ; then
  643.     cd "$KptHelp"
  644.     if [ -f "fulltext.v" ] ; then
  645.         if [ ! -f "fulltext.hlp" ] ; then
  646.         if [ ! -l "fulltext.hlp" ] ; then
  647.             ln -s "fulltext.v" "fulltext.hlp" >/dev/null 2>>/dev/null
  648.         fi
  649.         fi
  650.     fi
  651. #       restore back to original directory
  652.     cd "$dir"
  653.     fi
  654. }
  655.  
  656. fix6XScreenCapture()
  657. {
  658.     echo "Updating Screen Capture Plugin"
  659.     if [ -f $srcPlugins/ScreenCapture ] ; then
  660.     cp $srcPlugins/ScreenCapture $dstPlugins/Screen\ Capture
  661.     fi
  662. }
  663.  
  664. # find out the real Adobe Photoshop Name
  665. getAdobePhotoshopName
  666.  
  667. # compose user plug-in full path
  668. if [ "$PHOTOSHOP_ROOT" = "" ] ; then 
  669.     pluginFullpath=$HOME/AdobePhotoshop$versionMajor/Plug-ins
  670. else
  671.     pluginFullpath="$PHOTOSHOP_ROOT"/Plug-ins
  672. fi
  673.  
  674. # check if this is the system maintenance command
  675. checkSystemCommand ${1+"$@"}
  676.  
  677. # check if system has been updated
  678. # If not, prompt to the user and exit
  679. checkSystemHasBeenUpdated
  680.  
  681. # test if user has this plug-in directory
  682. test -d $pluginFullpath
  683. if [ $? != 0 ] ; then
  684.     if [ $hasUI = 1 ] ; then
  685.     ret=`xconfirm -c \
  686.          -t "" \
  687.          -t "You need to run photoshop at least one time before you can" \
  688.          -t "take advantage of this program." \
  689.          -t "" \
  690.          -icon error \
  691.          -b "OK" \
  692.          -header "Photoshop Performance Pack" ${1+"$@"}`
  693.     else
  694.     echo "You need to run photoshop at least one time before you can"
  695.     echo "take advantage of this program."
  696.     fi
  697.     exit 2
  698. fi
  699.  
  700. # check for multiple instances
  701. checkMultipleInstances
  702.  
  703. # go back to the original directory
  704. cd $workdir
  705.  
  706. displaySplashScreen
  707. showSplashScreen=$?
  708. if [ $showSplashScreen != 0 ] ; then
  709.     if [ $hasUI = 1 ] ; then
  710.     xconfirm -c \
  711.          -t "SGI Accelerated version of Adobe Photoshop $ver" \
  712.          -t "" \
  713.          -t "Adobe Photoshop (C) Copyright 1989-1996" \
  714.          -t "Adobe Systems Incorporated.  All rights reserved." \
  715.          -t "" \
  716.          -t "For additional information on this launch script, " \
  717.          -t "please man photoshop_sgi." \
  718.          -b "" \
  719.          -header "Photoshop Performance Pack" \
  720.          -noframe ${1+"$@"} & 
  721.     xconfirm_pid=$!
  722.     sleep 5
  723.     kill -9 $xconfirm_pid >/dev/null 2>>/dev/null
  724.     else
  725. #    No xconfirm utility, just display it inside this shell (should not happens)
  726.     echo "SGI Accelerated version of Adobe Photoshop $ver"
  727.     echo ""
  728.     echo "Adobe Photoshop (C) Copyright 1989-1996"
  729.     echo "Adobe Systems Incorporated.  All rights reserved."
  730.     fi
  731. fi
  732.     
  733. # setting up sgi photoshop plug-ins only if it is IP32
  734. sgiPlugins=/usr/lib/pshop/plug-ins
  735. userPlugins="$pluginFullpath"/SGI
  736. if [ $ip = "IP32" ] ; then
  737. #  make sure they are not pointing to the same directory
  738.     if [ "$sgiPlugins" = "$pluginFullpath" ] ; then
  739.         setlink=0
  740.     else 
  741.     if [ ! -l $userPlugins ] ; then
  742.             setlink=1
  743.         ln -s $sgiPlugins $userPlugins
  744.     fi
  745.     fi
  746. fi
  747.  
  748. # For any Photoshop version 3 or before, do the followings:
  749. if [ "$versionMajor" -le 3 ] ; then
  750.     PHOTOSHOP_BINARY="$sgiBinary"
  751.     export PHOTOSHOP_BINARY
  752.  
  753. #   link with the original Adobe Launch Script
  754.     if [ -f "$adobeRoot"/bin/photoshop.adobe.orig ] ; then
  755.     AdobePhotoshop="$adobeRoot"/bin/photoshop.adobe.orig
  756.     fi
  757. fi
  758.  
  759. # set TILE SIZE if it is not already set
  760. if [ "$PHOTOSHOP_DEBUG_TILESIZE" = "" ] ; then
  761.     PHOTOSHOP_DEBUG_TILESIZE=128
  762.     export PHOTOSHOP_DEBUG_TILESIZE
  763. fi
  764.  
  765. # trap all signals
  766. trap "" 0 1 2 3 4 5 8 10 12 15
  767.  
  768. # KPT workaround
  769. _RLD_ARGS=-ignore_unresolved
  770. export _RLD_ARGS
  771.  
  772. # execute the photoshop
  773. $AdobePhotoshop ${1+"$@"}
  774.  
  775. wait
  776.  
  777. # removing symbolic links
  778. if [ $ip = "IP32" ] ; then
  779.     if [ $setlink = 1 ] ; then
  780.     if [ -l $userPlugins ] ; then
  781.         rm $userPlugins
  782.         fi
  783.     fi
  784. fi
  785.  
  786. # remove lockFile
  787. if [ -f "$lockFile" ] ; then
  788.     rm "$lockFile"
  789. fi
  790.  
  791. # exit
  792.